<%@ page language="java" pageEncoding="utf-8"%>
<%@page import="java.util.List"%>
<%@page import="org.jbpm.graph.def.ProcessDefinition"%>
<%@page import="org.jbpm.graph.exe.ProcessInstance"%>
<%@page import="java.text.SimpleDateFormat"%>
<%@page import="java.util.Date"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<title>My JSP 'showJiLu.jsp' starting page</title>
	</head>

	<body>
		<h1>所有<%=request.getParameter("name").toString()%>申请记录有：</h1>
		<br>
		<table width="85%" border="1" cellpadding="0" cellspacing="0">
			<tr>
				<td>
					状态
				</td>
				<td>
					开始时间
				</td>
				<td>
					发起人
				</td>
				<td>
					详情
				</td>
			</tr>
			<%
				List list = (List) request.getAttribute("piList");
				if (list != null && list.size() > 0) {
					for (Object o : list) {
						ProcessInstance pi = (ProcessInstance) o;
						String status = "流程已经结束！！";
						if (!pi.hasEnded()) {
							status = "进行中。。。";
						}
						SimpleDateFormat df = new SimpleDateFormat(
								"yyyy-MM-dd HH:mm:ss");
						Date d = pi.getStart();
						String actor = pi.getContextInstance().getVariable(
								"issueperson").toString();
			%>
			<tr>
				<td><%=status%></td>
				<td><%=df.format(d)%></td>
				<td><%=actor%></td>
				<td>
					<a href="<%=request.getContextPath()%>/showBill.do?bill_id=<%=request.getAttribute("bill_id").toString()%>">查看详情</a>
				</td>
			</tr>
			<%
				}
				}
			%>
		</table>
	</body>
</html>
